package framework.entities;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class AppointmentData 
{
	public String patient;
	public String service;
	public String medicalOrganization;
	public String executor;
	private Date date;
	public String medicalCaseType;
	public String firstHospitalRecordDepartment;
	public String secondHospitalRecordDepartment;
	public String hospitalRecordResult;
	public String referralType;
	
	public void setDate(String dateFromCells) {
		date = new Date();
		DateFormat df = new SimpleDateFormat("dd.MM.yyyy HH:mm");
        try {
			date = df.parse(dateFromCells);
		} catch (ParseException e) {
			e.printStackTrace();
		}
    }
	
	public Date getDate() {
		return date;
	}
	
	public String getDateWithoutTime() {
		DateFormat df = new SimpleDateFormat("dd.MM.yyyy");
		return df.format(date);
	}

	@Override
	public String toString() {
		return "AppointmentData [patient=" + patient 
				+ ", service=" + service
				+ ", medicalOrganization=" + medicalOrganization
				+ ", executor=" + executor 
				+ ", date=" + date + "]";
	}	
}
